#include<bits/stdc++.h>
#define int long long
using namespace std;

const int N = 1e3 + 10;
const int Mod = 1e9 + 7;
int f[N][N], a[N], fac[N], inv[N], sum[N][N];
int ksm(int x, int y) {
	int res = 1, pw = x;
	while(y) {
		if(y % 2) res = res * pw % Mod;
		pw = pw * pw % Mod;
		y /= 2;
	}
	return res;
}
int C(int n, int m) {
	return fac[n] * inv[m] % Mod * inv[n - m] % Mod;
}
signed main() {
	freopen("game.in", "r", stdin);
	freopen("game.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, K;
	cin >> n >> K;
	K = n - K;
	fac[0] = 1;
	for(int i = 1; i <= n; i++) cin >> a[i], fac[i] = fac[i - 1] * i % Mod;
	inv[n] = ksm(fac[n], Mod - 2);
	for(int i = n - 1; i >= 0; i--) inv[i] = inv[i + 1] * (i + 1) % Mod;
	f[2][1] = a[1];
	sum[2][1] = (f[2][1] + ((a[2] - a[3] + Mod) % Mod)) % Mod;
	for(int i = 3; i <= n; i++) {
		f[i][1] = a[1] - a[2];
		sum[i][1] = (sum[i - 1][1] + (f[i][1] + ((a[i] - a[i + 1] + Mod) % Mod)) % Mod) % Mod;
	}
	for(int i = 2; i <= n + 1; i++) {
		for(int k = 2; k <= min(i - 1, K); k++) {
			if(i - 2 >= k - 1) f[i][k] = (sum[i - 2][k - 1] - sum[k - 1][k - 1] + Mod) % Mod;
			f[i][k] = (f[i][k] + (f[i - 1][k - 1] + a[i - 1] * C(i - 3, k - 2) % Mod) % Mod) % Mod;
			sum[i][k] = (sum[i - 1][k] + (f[i][k] + ((a[i] - a[i + 1] + Mod) % Mod) * C(i - 2, k - 1) % Mod) % Mod) % Mod;
		}
	}
	cout << f[n + 1][K] * ksm(C(n - 1, K - 1) % Mod, Mod - 2) % Mod;
}
